<template>
	<view class="content">
		<view class="section-0">
			<view class="item" @click="handleUpload()">
				<navigateItem>
					<template slot="left">
						<image mode="aspectFit" class="image-left" src="../../../../../../src/imgs/todo-info-icon-file.png" alt="">
					</template>
					<template slot="content">
						<text class="file-add-name">附件</text>
					</template>
					<template slot="right" v-if="type === 'add'">
						<image mode="aspectFit" class="image-right" src="../../../../../../src/imgs/account-icon-right.png" alt="">
					</template>
					<template slot="extra">
						<view v-if="file_name !== ''" class="file-name" @click="handleDownload(file_path)">
							{{file_name}}
						</view>
					</template>
				</navigateItem>
			</view>
			<view class="item" @click="handleUpload()">
				<navigateItem>
					<template slot="left">
						<image mode="aspectFit" class="image-left" src="../../../../../../src/imgs/todo-info-icon-file.png" alt="">
					</template>
					<template slot="content">
						<text class="file-add-name">附件2</text>
					</template>
					<template slot="right" v-if="type === 'add'">
						<image mode="aspectFit" class="image-right" src="../../../../../../src/imgs/account-icon-right.png" alt="">
					</template>
					<template slot="extra">
						<view v-if="file_name !== ''" class="file-name" @click="handleDownload(file_path)">
							{{file_name}}
						</view>
					</template>
				</navigateItem>
			</view>
			<view class="item" @click="handleUpload()">
				<navigateItem>
					<template slot="left">
						<image mode="aspectFit" class="image-left" src="../../../../../../src/imgs/todo-info-icon-file.png" alt="">
					</template>
					<template slot="content">
						<text class="file-add-name">附件3</text>
					</template>
					<template slot="right" v-if="type === 'add'">
						<image mode="aspectFit" class="image-right" src="../../../../../../src/imgs/account-icon-right.png" alt="">
					</template>
					<template slot="extra">
						<view v-if="file_name !== ''" class="file-name" @click="handleDownload(file_path)">
							{{file_name}}
						</view>
					</template>
				</navigateItem>
			</view>
			<view class="msg">
				<view class="title">
					  <view class="body-title">会检意见</view>
					  <view class="body-time">2022-10-22</view>
				</view>
				<view class="textarea">
					<u--textarea
						:maxlength="-1"
						placeholderClass="textarea-placeholder"
						class="textarea-body"
					    placeholder="请输待办详情"
					    v-model="form.yj_content"
						border='null'
						
					  ></u--textarea>
				
				</view>
			</view>
			<view  class="custom-button" @click="handleAdd()">
				提交
			</view>
		
		</view>
		<l-file 
		    ref="todoInfoFile" 
		    @up-success="uploadSuccess"
		></l-file>
	</view>
</template>

<script>
	import userSelect from '@/components/user_select/index.vue';
	import { mapGetters } from 'vuex';
	import { todoInfoApi, todoAddApi, todoUpdateApi, todoReceiveListApi } from '@/api/todo.js'
	import { uploadApi, fileInfoApi } from '@/api/common.js'
	import navigateItem from '@/components/navigate_item/index.vue'
	export default {
		components: {
			navigateItem, userSelect
		},
		data() {
			return {
				checked: false,
				type: '',
				id: '',
				form: {
					yj_content: '',
					receive_user: '',
					end_date: '',
					file_id: '',
				},
				receiveList: [],
				file_name: '',
				file_path: '',
				userList: [],
				selectedUser: [],
				selectedDate: '',
				showDate: false,
				showUser: false,
				userList: []
			};
		},
		computed: {
			...mapGetters({ 
				userInfo: 'system/getUserInfo',
			}),
		},
		methods: {
			handleDownload(url) {
				this.$refs.todoInfoFile.download({url})
				// this.$refs.todoInfoFile.download({url})
				// .then(path=>{
				//     this.$refs.todoInfoFile.open(path);
				// });
			},
		},
	}
</script>

<style lang="scss" scoped>

	.content{
		width: 100%;
		background-color: #fff;
		position: relative;
		.pop{
			width: 671rpx;
			padding-bottom: 40rpx;
			background-color: #fff;
			border-radius: 35rpx;
			overflow: hidden;
			.title{
				width: 100%;
				height: 96rpx;
				line-height: 96rpx;
				background-color: #ffffff;
				font-size: 42rpx;
				font-weight: normal;
				font-stretch: normal;
				letter-spacing: 4rpx;
				color: #ffffff;
				text-align: center;
				@include clear();
			}
		}
		.user-pop{
			.body{
				padding: 40rpx 50rpx;
				.wrapper{
					width: 100%;
					height: 540rpx;
					overflow-y: auto;
					overflow-x: hidden;
				}
				.item{
					width: auto;
					height: 60rpx;
					@include clear();
					.check{
						width: 24rpx;
						height: 24rpx;
						border: solid 1rpx #000000;
						border-radius: 50%;
						float: left;
						margin-top: 16rpx;
						position: relative;
						.check-on{
							transition: 0.3s ease;
							opacity: 0;
							transform: scale(0.5);
							border-radius: 50%;
							position: absolute;
							top: 0;
							left: 0;
							right: 0;
							bottom: 0;
							margin: auto;
							width: 18rpx;
							height: 18rpx;
							background-color: #000000;
						}
					}
					.name{
						float: left;
						font-size: 32rpx;
						font-weight: 300;
						height: 60rpx;
						font-stretch: normal;
						line-height: 60rpx;
						letter-spacing: 0rpx;
						color: #000000;
						margin-left: 20rpx;
					}
					.check__active{
						.check-on{
							opacity: 1;
							transform: scale(1);
						}
					}
				}
			}
		}
		.date-pop{
			.body{
				width: 100%;
				box-sizing: border-box;
				padding-bottom: 50rpx;
				/deep/ {
					.uni-calendar-item__weeks-box-item{
						width: 50rpx;
						height: 50rpx;
						font-size: 28rpx;
						font-weight: normal;
						font-stretch: normal;
						line-height: 50rpx;
						letter-spacing: 0rpx;
						color: #000000;
						margin-top: 20rpx;
						margin-bottom: 20rpx;
					}
					.uni-calendar-item--isDay-text{
						color: #000;
					}
					.uni-calendar-item__weeks-lunar-text{
						display: none;
					}
					.uni-calendar-item--checked{
						background: none;
						opacity: 1;
						.uni-calendar-item__weeks-box-item{
							background: #ffffff;
							color: #fff;
							border-radius: 50%;
						}
					}
					.uni-calendar__backtoday{
						display: none;
					}
					.uni-calendar__header-text{
						font-size: 42rpx;
						font-weight: normal;
						font-stretch: normal;
						letter-spacing: 4rpx;
						color: #1534ce;
					}
					.uni-calendar__header{
						justify-content: space-between;
						height: 100rpx;
						line-height: 100rpx;
					}
					.uni-calendar-item--isDay{
						background: none;
						opacity: 1;
						color: #fff!important;
						 .uni-calendar-item__weeks-box-item{
							background: #1534ce;
							color: #fff;
							border-radius: 50%;
						}
					}
				}
			}
			.btns-container{
				width: 100%;
				display: flex;
				justify-content: space-between;
			}
		}
		.section-0{
			width: 100%;
			border-top-left-radius: 50rpx;
			border-top-right-radius: 50rpx;
			background-color: #fff;
			padding-top: 50rpx;
			.custom-button{
				margin-top: 50rpx;
			}
			.file-name{
				width: 100%;
				box-sizing: border-box;
				font-size: 25rpx;
				font-weight: 300;
				font-stretch: normal;
				letter-spacing: 0rpx;
				color: #1534ce;
				padding-left: 35rpx;
				padding-right: 35rpx;
				padding-bottom: 35rpx;
				padding-top: 10rpx;
			}
			.image-left{
				width: 34rpx;
				height: 79rpx;
			}
			.image-right{
				width: 16rpx;
				height: 79rpx;
			}
			.member{
				max-width: 500rpx;
				overflow:hidden;
				text-overflow:ellipsis;
				white-space:nowrap;
			}
			.member__send{
				.users{
					float: left;
					width: 330rpx;
					overflow:hidden;
					text-overflow:ellipsis;
					white-space:nowrap;
				}
				.unfinished{
					display: block;
					width: 170rpx;
					color: #1534ce;
					float: right;
					text-align: right;
				}
			}
			.item{
				margin-bottom: 34rpx;
			}
			.msg{
				width: 672rpx;
				background-color: #ffffff;
				border-radius: 35rpx;
				margin: 0 auto;
				margin-bottom: 34rpx;
				box-shadow: 0 0 28rpx 14rpx rgba(#bcbcb5, 0.17);
				overflow: hidden;
				box-sizing: border-box;
				.title{
					width: 100%;
					height: 96rpx;
					line-height: 96rpx;
					background-color: #ffffff;
					@include clear();
					margin-left: 0;
					box-sizing: border-box;
					padding: 0 30rpx;
					.body-title{
						display: inline-block;
						float: left;
						height: 96rpx;
						font-weight: bold;
					}
					.body-time{
						display: inline-block;
						font-size: 16rpx;
						float: right;
						height: 96rpx;
						color: #7f98ae;
					}
					.input-body{
						box-sizing: border-box;
						width: 100%;
						height: 96rpx;
						padding: 0!important;
						border: none;
						padding-left: 30rpx!important;
						padding-right: 30rpx!important;
						font-size: 42rpx;
						font-weight: normal;
						font-stretch: normal;
						letter-spacing: 0rpx;
						/deep/ .uni-input-input{
							color: #fff;
						}
					}
					
					.input-placeholder{
						font-size: 42rpx;
						
						font-weight: normal;
						font-stretch: normal;
						letter-spacing: 4rpx;
						color: rgba(255, 255, 255, 0.2);
					}
				}
				.textarea{
					width: 100%;
					line-height: 30rpx;
					padding-bottom: 40rpx;
				// background-color: #ff1e80;
					.textarea-body{
						box-sizing: border-box;
						width: 100%;
						
						border: none;
						padding: 2rpx 30rpx!important;
						font-weight: normal;
						font-stretch: normal;
						letter-spacing: 0rpx;
					
						
						/deep/ .u-textarea__field{
								width: 580rpx;
								height: 283rpx;
							font-size: 25rpx;
							// background-color: #ff1e80;
							
							padding: 16rpx;
							border-radius: 20rpx;
							border: solid 2rpx #0535d6;
						}
					}
					/deep/ .u-textarea--disabled{
						background-color: #fff;
						
					}
				
					.textarea-placeholder{
						font-family: SourceHanSansCN-Light;
						font-size: 26rpx;
						font-weight: normal;
						font-stretch: normal;
						line-height: 34rpx;
						letter-spacing: 0rpx;
						color: #46464a;
						opacity: 0.5;
						margin: 6rpx;
						
					}
				}
			}
		}
	}
	.title{
			width: 103rpx;
			height: 25rpx;
			font-family: SourceHanSansCN-Medium;
			font-size: 26rpx;
			font-weight: normal;
			font-stretch: normal;
			line-height: 34rpx;
			letter-spacing: 0rpx;
			color: #46464a;
			background-color: #ffffff;
			margin-left: 38rpx;
	}
	.file-add-name{
			font-family: SourceHanSansCN-Regular;
			font-size: 26rpx;
			font-weight: normal;
			font-stretch: normal;
			line-height: 34rpx;
			letter-spacing: 0rpx;
			color: #1534ce;
	}
</style>
